export default (cellvalue) => {
    let num = cellvalue;
    if (isNaN(num))
        num = "0";
    let sign = (num == (num = Math.abs(num)));
    let cents = num % 1000;
    num = Math.floor(num / 1000).toString();
    if (cents < 10) {
        cents = "00" + cents;
    } else {
        if (cents < 100) cents = "0" + cents;
    }
    for (let i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
        num = num.substring(0, num.length - (4 * i + 3)) + ',' +
        num.substring(num.length - (4 * i + 3));
    return (((sign) ? '' : '-') + num + '.' + cents);
}